iT邦幫忙

2021 iThome 鐵人賽

DAY 20
0
DevOps

Hashicorp Jot Notes系列 第 20

Day 20. Hashicorp Nomad: Docker driver image behavior

  • 分享至 

  • xImage
  •  

Hashicorp Nomad: Docker driver image behavior

在Hashicorp forum看到這篇文章很有趣 Nomadproject.io missing documentation about Docker driver image behavior

內容

有使用者發現Nomad文件並未對nomad pull image,是先檢查本地還是先從docker hub拉取有說明,所以看能不能在文件上說明,然後找出code, 說明Nomad在 image tag 是有特別處理的,後來Nomad文件也補上說明。

. image - The Docker image to run. The image may include a tag or custom URL and should include https:// if required. By default it will be fetched from Docker Hub. If the tag is omitted or equal to latest the driver will always try to pull the image. If the image to be pulled exists in a registry that requires authentication credentials must be provided to Nomad. Please see the Authentication section.

// loading it from the file system
func (d *Driver) createImage(task *drivers.TaskConfig, driverConfig *TaskConfig, client *docker.Client) (string, error) {
	image := driverConfig.Image
	repo, tag := parseDockerImage(image)

          
	// We're going to check whether the image is already downloaded. If the tag
	// is "latest", or ForcePull is set, we have to check for a new version every time so we don't
	// bother to check and cache the id here. We'll download first, then cache.
	if driverConfig.ForcePull {
		d.logger.Debug("force pulling image instead of inspecting local", "image_ref", dockerImageRef(repo, tag))
	} else if tag != "latest" {
		if dockerImage, _ := client.InspectImage(image); dockerImage != nil {
			// Image exists so just increment its reference count
			d.coordinator.IncrementImageReference(dockerImage.ID, image, task.ID)
			return dockerImage.ID, nil
		}
	}

          
	// Load the image if specified
	if driverConfig.LoadImage != "" {
		return d.loadImage(task, driverConfig, client)

上一篇
Day 19. Hashicorp Vault: Audit log (2)
下一篇
Day 21. Hashicorp Vault: Path limit
系列文
Hashicorp Jot Notes30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言